                      WavPlayer 1.0 by Florent Dhordain
                      ---------------------------------

OK, this isn't really a readme file, but things you might want to know if
you're a z80 programmer, or if you want to make your own waves (use make4bit)

WavPlay is a simple, cool, 4 bit wav player. It uses pulse modulation in order
to produce 4 bit sampled sound.

It uses ZASMLOAD, and external sound programs

What is pulse modulation ?

OK, if you've got electronics curses, you might have learned that if you make
a periodic rectangular signal, you were able to control the speed of a motor.
In fact, you change the mean of the signal.
The formula is :

U(volts)
^
5| +-------+     |
 | |       |     |
 | |  Th   |     |
 | |<----->|     |
0| +       +-----+
 +----------------------> t(sec)
          T
   <------------->

Umean = Th/T * 5
( a bit simplified, cause the real formula is Th/T * Uhi + Tl/T * Ulo, with
  Tl = T-Th )

Now, if you make it 11000 times a second, you'll be able to make 11000 samples
of different amplitude each second.


Waves files must be 11Khz sampled
Make4bit creates a 83p from the wav file, but in any case the 83p musn't be
bigger than 26000 bytes (due to ti-83 small memory)

WAV file format:
---------------

00 W A V 04 Sizelo SizeHi Data..... Description(ASCIIZ)

No description if Size+5=ProgSize

1 seconde -> 11025/2 bytes = 5512.5

x byte -> x*(2/11025) seconde

Why I didn't release the source ?
Cause I borrowed some parts of another program nobody should have the 
source, so I'm not even sure I should distibute the 83p...

Rutine I used to produce a sample :
-----------------------------------
dosample:
	LD   B, C		; 4
	INC  B			; 4
	LD   A, linkon		; 7
thloop:
	OUT  (0), A		; 11*(vol+1)
	DJNZ thloop		; 13*(vol+1)+8

	LD   A,MAXVOL+1 	; 7		A
	SUB  C			; 4
	LD   B, A		; 4		B = MAXVOL-vol+1
	LD   A, linkoff 	; 7
tlloop:
	OUT  (0), A		; 11*(MAXVOL-vol+1)
	DJNZ tlloop		; 13*(MAXVOL-vol+1)+8
	RET			; 10
; ( there was a call upper )    : 17
; = 53+24*(MAXVOL+2) +10 +17
; = 438 cycles
; = 73 usec

